import java.util.Arrays;
public class Demo5 {
    public static void main(String[] args) {
        int[] nums = {1,3,5,8,7,4};
        int target = 9;
        int[] i =twoSum(nums,target);
        System.out.println(Arrays.toString(i));
    }
    public static int[] twoSum(int[] nums,int target) {
        int[] tmp = new int[2];
        for(int i = 0; i < nums.length; i++) {
            for(int j = i+1;j < nums.length;j++) {
                if(nums[i] + nums[j] == target && j!=i) {
                    tmp[0] = i;
                    tmp[1] = j;
                    return tmp;
                }
            }
        }
        return new int[]{-1,-1};
    }
}
